<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f ="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      >

        <c:if test="#{sessionScope.myCar==null}">
            <c:set var="myCar" scope="session" value="#{myCar}"/>
        </c:if>
        <c:set var="buylist" value="#{myCar.buylist}"/>

      <table border="1" width="250" rules="none" cellspacing="0" cellpadding="0" style="float:left">
      <tr height="50"><td colspan="2" align="center">我的购物车</td></tr>
      <tr align="center" height="30" bgcolor="lightgrey">
        <td>图片</td>
        <td>名称</td>
      </tr>
      
        <c:choose>
      <c:when test="#{buylist == null || buylist.isEmpty()}">
          <tr height="100"><td colspan="2" align="center">您的购物车为空！</td></tr>
      </c:when>
      <c:otherwise>

          <c:forEach var="i" begin="0" end="#{buylist.size() - 1}">
              <c:set var="single" value="#{buylist.get(i)}"/>
              <c:set var="name" value="#{single.name}"/>
              <c:set var="url" value="#{single.imgurl}"/>
        
     
            <tr align="center" height="50">
                     <td><img style='width:50px;' src='#{url}' /></td>
                     <td>
                     #{name}
                     </td>
                     </tr>
           </c:forEach>
          </c:otherwise>
      </c:choose>
 
      </table>
</html>

    